package util
{
	import flash.filesystem.File;
	import flash.filesystem.FileMode;
	import flash.filesystem.FileStream;

	public class FileUtils
	{
		public function FileUtils()
		{
		}
		
		public static function readFile(url:String):Object{
			var file:File = new File(url);
			if(!file.exists){
				return null;
			}
			
			var fs:FileStream = new FileStream();
			fs.open(file,FileMode.READ);
			var obj:Object = fs.readObject();
			fs.close();
			return obj;
		}
		public static function writeFile(obj:Object,url:String):void{
			var file:File = new File(url);
			
			var fs:FileStream = new FileStream();
			fs.open(file,FileMode.WRITE);
			fs.writeObject(obj);
			fs.close();
		}
		
		
	}
}